/*============================================================================
 * Project    : GameZone
 * Name       : NormalContainer.h
 * Author     : Administrator
 * Version    : 1.0
 * Copyright  : Copyright (c) 2009,Aspire-tech technology com, Ltd.
 * All rights reserved.
 * Created on : 2010-10-2 11:39:28
 * Description: {description}
 *============================================================================
 */

#ifndef NORMALCONTAINER_H_
#define NORMALCONTAINER_H_

#include <coecntrl.h>
#include <akniconutils.h>
#include "GuiFactory.h"
#include "CustomContainer.h"
#include "BaseControl.h"
#include "IndicatorControl.h"
#include "TitleBar.h"

class MEikCommandObserver;

class CNormalContainer: public CCoeControl,public MControlEventObserver,public MIndicatorObserver
{
public:
    CNormalContainer();
    static CNormalContainer* NewL( 
        const TRect& aRect, 
        const CCoeControl* aParent, 
        MEikCommandObserver* aCommandObserver );
    static CNormalContainer* NewLC( 
        const TRect& aRect, 
        const CCoeControl* aParent, 
        MEikCommandObserver* aCommandObserver );
    virtual void ConstructL( 
        const TRect& aRect, 
        const CCoeControl* aParent, 
        MEikCommandObserver* aCommandObserver );
    virtual ~CNormalContainer();
    
public:
    // from base class CCoeControl
    TInt CountComponentControls() const;
    CCoeControl* ComponentControl( TInt aIndex ) const;
    TKeyResponse OfferKeyEventL( 
            const TKeyEvent& aKeyEvent, 
            TEventCode aType );
    void HandleResourceChange( TInt aType );
    void HandlePointerEventL(const TPointerEvent& aPointerEvent);
    void Draw( const TRect& aRect ) const;
    
public:
    // from base class MControlEventObserver
    void HandleControlEventL(CCoeControl* aControl,TEventType aEventType);
    // from base class MIndicatorObserver
    void HandleIndicatorEventL(TInt aResult);
    
    void AddControlL(CCoeControl* aControl);
    void UpdateControls(TInt aOffset = 0);
    void ShowWaitIndicator(const TRect& aRect, const TDesC& aText,TBool aCanCancel);
    void HideWaitIndicator();
    void setTitleTextL(const TDesC& aText);
    void setTitleButton(const TDesC& aText, TInt aActionType);
    void setBackGroundBitmapL(CImage* aImg);
    
protected:
    void SizeChanged();

private:
    void InitializeControlsL(const TRect& aRect);
    void LayoutControls();
  
protected: 
    CTitleBar* iTitleBar;
    CContainerControl* iContainer;
    CCoeControl* iAd;
    CContainerControl* iToolBar;
    CIndicatorControl* iIndicator;
    CCoeControl* iFocusControl;
    MEikCommandObserver* iCommandObserver;
    
private:
    CImage* iBackGroundBitmap;
    
public: 
    enum TControls
        {
		ETitleBar,
        EContainer,
        EAd,
        EToolBar,
        EIndicator,
        ELastControl
        };
};

#endif /* NORMALCONTAINER_H_ */
